﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Content/Master.Master" Inherits="System.Web.Mvc.ViewPage<SCS.Core.ViewModels.SupportViewModels>" %>
<%@ Import Namespace="SCS.Core" %>
<%@ Import Namespace="SCS.Core.Models" %>
<%@ Import Namespace="SCS.Core.ViewModels" %>
<%@ Import Namespace="SCS.Core.Controllers" %>
<%@ Import Namespace="SCSService" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Danh sách hỗ trợ
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript" src="/ThemeExtends/AdminSkin/js/jquery.flot.js"></script>
<script type="text/javascript" src="/ThemeExtends/AdminSkin/js/jquery.flot.stack.js"></script>	

<% using (Html.BeginForm("ListSupport", "AdvantageSetting", FormMethod.Post, new { id = "sendFileForm", enctype = "multipart/form-data" }))
   {%>
    <div class="clear"></div>
    <div class="column full">
    <div class="box ">
		<h2 class="box-header">	Danh sách hỗ trợ </h2>
		<div class="box-content">

                    <div id="grid">
		    					 <div style="margin: 5px; float:right;">
                                    <%= Html.ActionLink("Thêm mới", "DetailSupport", null, new { @Class = "button themed" })%>
                                 </div>	               
				               <table class="display" id="tabledata">
                                <thead>
					                <tr>
						               			               
						                 <th>
							                
								                Tên 
						                </th>
						
						                <th>
							      
								                Loại hỗ trợ
						                </th>											                

                                        <th>
                                            Tài khoản
                                        </th>
                                       

                                        <th>
                                            Mô tả
                                        </th>
                                        <th>
                                           Trạng thái
                                        </th>
                                        <th>Hành động</th>
                                       
					                </tr>
                                  
                                </thead>
                                <% if (Model.SupportItem.Count() == 0) { %>
			                        <tbody>
                                        <tr>
                                            <td colspan="9">
                                                Không tìm thấy
                                            </td>
                                        </tr>
                                    </tbody>
		                        <% } else { %>
                                <tbody>
					                <% foreach (var item in Model.SupportItem) { %>
				    
						                <tr>						                
                                            

							                <td>
								                <%= item.SupportName %>
							                </td>
							
							                <td>
								                <%= item.SupportType %>
							                </td>
														                
                                            <td>
                           
                                                <%: item.SupportAccount %>
                                            </td>
                                    
                                            <td>
                                            <%: item.SupportText %>
                                            </td>
                                               
                                            <td>
                                                <%
                                                    bool newStatus=false;
                                                    string StringStatus = "";
                                                    if (item.SupportActive == true)
                                                    {
                                                        newStatus=true;
                                                        StringStatus="Kích hoạt";
                                                    }
                                                    else if (item.SupportActive == false)
                                                    {
                                                        newStatus=false;
                                                        StringStatus = "Không kích hoạt";
                                                    }
                                                    
                                                %>
                                                <%=StringStatus%>
                                                <%--<%
                                                    List<SelectListItem> statusDrop = new List<SelectListItem>();
                                                    statusDrop.AddRange(new SelectListItem[] { 
                                                    new SelectListItem{Selected=newStatus, Text = "Kích hoạt", Value = "1" },
                                                    new SelectListItem{Selected=newStatus, Text = "Không kích hoạt", Value = "0" }
                                                });
                                                %>
                                               
                                               <%= Html.DropDownList("statusID" + item.SupportID, statusDrop, new { onchange = "SaveStatus(this," + item.SupportID + ")" })%>--%>
                                            </td>
                                            <td>   
								              <%--  <%= Html.ActionLink("Cập nhật", "EditSupport", new { id = item.SupportID })%>--%>	
                                                <span class="button white"> <%= Html.ActionLink(" ", "EditSupport", new { id = item.SupportID }, new { @class = "icon_single edit", style = "color:#f7a468;" })%></span>	<!--cap nhat-->		
                                                  <span class="button white"><%= Html.ActionLink(" ", "DeleteSupport", new { id = item.SupportID }, new { @class = "icon_single cancel", style = "color:#cc0000;", onclick = "return confirm('Bạn thực sự muốn xóa?');" })%></span>						                
							                </td>
                                         <%--   <td>
                                                <%= Html.ActionLink("Xóa", "DeleteSupport", new { id = item.SupportID }, new { onclick = "return confirm('Are you sure delete ?');" })%>
                                          

                                           </td>--%>
						                </tr>
				    
					                <% } %>
					            </tbody>
                                <% } %>
				                </table>
			                <!-- data -->
                              <%--  <% if (Model.SupportItem.Count() > 0) { %>
			                       <% Html.RenderPartial("~/Views/Commont/Paging.ascx"); %>
		                        <% } %>--%>
		                
	                </div>  <!-- grid -->	
                
               
	    </div>
	</div>
    <div class="clear"></div>
    </div>    
<% } %>

</asp:Content>
